//
//  StayUseTableView.m
//  duoduo
//
//  Created by wanghao on 16/10/12.
//  Copyright © 2016年 LX. All rights reserved.
//

#import "StayUseTableView.h"
#import "DrivingOrderCell.h"
#import "PostImageViewController.h"
#import "DrivingInfo_ViewController.h"
#import "CarLocationViewController.h"

@interface StayUseTableView ()

@end

@implementation StayUseTableView


- (void)viewDidLoad {
    [super viewDidLoad];
    self.tableView.backgroundColor = LXHexColor(0xF5F6F7);
    [self.tableView registerNib:[UINib nibWithNibName:@"DrivingOrderCell" bundle:nil]forCellReuseIdentifier:@"orderCell"];
    self.tableView.tableFooterView = [[UIView alloc]init];
}

//上传照片跳转
- (void)postImageClick
{
    PostImageViewController * vc = [[PostImageViewController alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)locationClick
{
    CarLocationViewController * vc = [[CarLocationViewController alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return 1;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    DrivingOrderCell *cell = [tableView dequeueReusableCellWithIdentifier:@"orderCell"];

   // if (indexPath.section == 0) {
        [cell.postImageBtn addTarget:self action:@selector(postImageClick) forControlEvents:UIControlEventTouchUpInside];
//    }else if (indexPath.section == 1) {
//        cell.cancelBtn.alpha = 0;
//        cell.autoCancel.alpha = 0;
//        [cell.postImageBtn setTitle:@"开启车门" forState:UIControlStateNormal];
//    }else if (indexPath.section == 2) {
//        cell.cancelBtn.alpha = 0;
//        cell.autoCancel.alpha = 0;
//        [cell.postImageBtn setTitle:@"停车位置" forState:UIControlStateNormal];
//        [cell.postImageBtn addTarget:self action:@selector(locationClick) forControlEvents:UIControlEventTouchUpInside];
//    }

    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    // 取消选中状态
    [tableView deselectRowAtIndexPath:indexPath animated:NO];
//    DrivingInfo_ViewController * drivingInfoVC = [[DrivingInfo_ViewController alloc]init];
//    [self.navigationController pushViewController:drivingInfoVC animated:YES];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 215;
}


- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 20;
}

@end
